#define _CRT_SECURE_NO_WARNINGS 1

class Gift {
public:
    int getValue(vector<int> gifts, int n) {
        int cnt = 0;
        sort(gifts.begin(), gifts.end());
        for (int i = 0; i < n; ++i)
        {
            if (gifts[i] == gifts[n / 2])
                ++cnt;
        }
        if (cnt > (n / 2))
            return gifts[n / 2];
        return 0;
    }
};